package com.ruoyi.ylyx.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.EmptyUtils;
import com.ruoyi.ylyx.domain.YlyxGame;
import com.ruoyi.ylyx.service.IYlyxGameService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 轮播Controller
 *
 */
@Controller
@RequestMapping("/phone/ylyx/game")
public class YlyxGamePhoneController extends BaseController
{

    @Autowired
    private IYlyxGameService ylyxGameService;

    /**
     * 获取首页游戏
     * @param type 1客户端游戏 2手机端游戏
     * @return
     */
    @RequestMapping("/getGameHome")
    @ResponseBody
    public AjaxResult getGameHome(String type){
        YlyxGame game = new YlyxGame();
        if(EmptyUtils.isNotEmpty(type)){
            if("1".equals(type)){//客户端游戏
                type = "875140349960392704";
            }else{//手机端游戏
                type = "875140378259361792";
            }
            game.setGameType(type);
        }
        return success("获取成功", ylyxGameService.selectYlyxGameList(game));

    }


    /**
     * 获取游戏列表
     * @return
     */
    @RequestMapping("/getGameList")
    @ResponseBody
    public AjaxResult getGameList(String id){
        YlyxGame game = new YlyxGame();
        game.setId(id);
        return success("获取成功", ylyxGameService.selectYlyxGameList(game));
    }
}
